package rnd;

import java.util.Random;

public class Choose {

	private static final Random rnd = new Random();

	public static void main(String[] args) {
		int[] dices = new int[]{4,6,8,10,12,20};
		int[] successes = new int[]{0,0,0,0,0,0};
		int tries = 100000;

		for (int i = 0; i < dices.length; i++) {
			int dice = dices[i];

			for (int j = 0; j < tries; j++) {
				int t1 = d(dice);
				int t2 = d(dice);

				if (t1 <= dice/2) {
					if (t2 > t1) {
						successes[i]++;
					}
				} else {
					if (t2 < t1) {
						successes[i]++;
					}
				}
			}
		}

		for (int i = 0; i < dices.length; i++) {
			System.out.println(dices[i] + "\t" + (float) 100*successes[i]/tries);
		}

	}

	private static int d(int dice) {
		return rnd.nextInt(dice) + 1;
	}

}
